<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%String contextRoot = request.getContextPath();%>
<f:loadBundle basename="properties.messages" var="msg"/>
<f:view>
<!doctype html>
<html>
<head>
	<%@ include file="include/meta.jsp" %>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title>SISDEP : Sistema de Informaci<h:outputText value="#{msg.tilde_o}" />n de Espacio P<h:outputText value="#{msg.tilde_u}" />blico</title>
	<meta name="description" content="">
	<meta name="author" content="">
	<link rel="stylesheet" href="<%=contextRoot%>/css/validationEngine.jquery.css" type="text/css"> <!-- Del validador de formularios -->
	<link rel="stylesheet" href="<%=contextRoot%>/css/normalize.css">
	<link rel="stylesheet" href="<%=contextRoot%>/css/uniform.css"> <!-- estilos formularios -->
	<link rel="stylesheet" href="<%=contextRoot%>/css/cuerpo.css">
	<link rel="stylesheet" href="<%=contextRoot%>/css/richCustom.css">
</head>
<body>
<div id="marco"> <!--inicio contenedor --> 
<div class="arriba-cuerpo"></div> <!-- Burrada pa ver borde redondo en IE -->
<div class="cuerpo">
<a href="<%=contextRoot%>/index.jsf"><img src="<%= contextRoot %>/images/logos.png" /></a>
<div class="clear"></div>
<!-- Menu y Usuario init() -->
	<%@ include file="include/menuUsuario.jsp" %>
<!-- Menu y Usuario end() -->
<div class="clear"></div>
<!-- Formulario -->
<div id="buscador">
<h2>Gesti<h:outputText value="#{msg.tilde_o}" />n de Terceros: <h:outputText value="#{proveedorController.proveedor.id eq 0 ? 'NUEVO' : 'EDICION'}" /></h2>
<h:form id="createProveedorForm">
		<fieldset>
		<legend>Representante Legal</legend>			
		<span class="left" >
		<label>Tipo Identificaci<h:outputText value="#{msg.tilde_o}" />n<span class="asterisco">*</span></label>							
			<h:selectOneMenu id="idTipoIdentificacionStr" styleClass="validate[required]" value="#{proveedorController.proveedor.idTipoDocumentoStr}">
				<f:selectItem itemLabel="Seleccione..." itemValue=""/>
				<f:selectItems value="#{masterListCache.classIdentificationForFilingType}"/>
            </h:selectOneMenu>
		</span>			
		<span class="left" style="margin-left: 100px;">
		<label>Identificaci<h:outputText value="#{msg.tilde_o}" />n<span class="asterisco">*</span></label> 
			<h:inputText id="identificacion" size="20" maxlength="20"
			styleClass="validate[required]" value="#{proveedorController.proveedor.documentoPersona}" />
		</span>						
		<span class="left" style="margin-left: 10px;">
		<label> &nbsp; </label> 
			<a4j:commandButton id="checkPersonaButton"											 
			                 type="submit" 
			                 value="Verificar..." ajaxSingle="true" 
			                 ondblclick="return false;" reRender="checkPersonaPanel"
	                         action="#{proveedorController.checkPersonaRegistrada}" >
	                         <a4j:actionparam name="tipoIdentificacionParam" value="document.getElementById('createProveedorForm:idTipoIdentificacionStr').value" 
	                                          assignTo="#{proveedorController.proveedor.idTipoDocumentoStr}" noEscape="true" />
	                         <a4j:actionparam name="identificacionParam" value="document.getElementById('createProveedorForm:identificacion').value" 
	                                          assignTo="#{proveedorController.proveedor.documentoPersona}" noEscape="true" />
			</a4j:commandButton>
		</span>	
		<div class="clear" style="margin-left: 400px;"></div>

		<span class="left" style="margin-left:0px"><label>
		<a4j:outputPanel id="checkPersonaPanel" layout="block" >
			<h:panelGrid columns="1" style="text-align: left; width: 400px;" styleClass="tablapaginacion" >
			<h:outputText value="Persona Registrada: #{proveedorController.personaLocal.primerNombre}    #{proveedorController.personaLocal.segundoNombre}    #{proveedorController.personaLocal.primerApellido}    #{proveedorController.personaLocal.segundoApellido}" />
                     </h:panelGrid>
                    </a4j:outputPanel>
                    </label>
		</span>		
		<div class="clear" style="margin-left: 400px;"></div>
		<span class="left" >
		<label>Cargo<span class="asterisco">*</span></label>
				<h:inputText id="contactoCargo" size="40" maxlength="40" styleClass="validate[required]"
						value="#{proveedorController.proveedor.contactoCargo}" />
		</span>
		</fieldset>	
		<fieldset>
		<legend>Empresa</legend>		
		<span class="left" >
		<label>Tipo <span class="asterisco">*</span></label>
				<h:selectOneMenu id="tipo" styleClass="validate[required]" value="#{proveedorController.proveedor.tipoProveedor}">
                        <f:selectItem itemLabel="Seleccione..." itemValue=""/>
                        <f:selectItem itemLabel="Proveedor" itemValue="Proveedor"/>
                        <f:selectItem itemLabel="Empresa" itemValue="Empresa"/>                        
                </h:selectOneMenu>
		</span>
		<div class="clear"></div>
		<br/>
		<span class="left" >
		<label>NIT <span class="asterisco">*</span></label>
				<h:inputText id="nit" size="15" maxlength="15" styleClass="validate[required]"
						value="#{proveedorController.proveedor.nit}" />
		</span>
		<span class="left" style="margin-left:35px">
		<label>Nombre<span class="asterisco">*</span></label>
				<h:inputText id="nombre" size="60" maxlength="128" styleClass="validate[required]"
						value="#{proveedorController.proveedor.nombre}" />
		</span>
		<div class="clear" style="margin-left: 400px;"></div>
		<br/>
		<span class="left" >
		<label>Email <span class="asterisco">*</span></label>
				<h:inputText id="email" size="40" maxlength="60" styleClass="validate[custom[email]]"
						value="#{proveedorController.proveedor.email}" />
		</span>
		<span class="left" style="margin-left:35px">
		<label>N<h:outputText value="#{msg.tilde_u}" />mero telef<h:outputText value="#{msg.tilde_o}" />nico <span class="asterisco">*</span></label>
				<h:inputText id="numeroTelefonico" size="10" maxlength="10" styleClass="validate[required,custom[integer],minSize[7]]"
						value="#{proveedorController.proveedor.numeroTelefonico}" />
		</span>
		<span class="left" style="margin-left:35px">
		<label>Otro n<h:outputText value="#{msg.tilde_u}" />mero Telef<h:outputText value="#{msg.tilde_o}" />nico </label>
				<h:inputText id="numeroTelefonicoOtro" size="10" maxlength="10" styleClass="validate[custom[integer],minSize[7]]"
						value="#{proveedorController.proveedor.numeroTelefonicoOtro}" />
		</span>		
		<div class="clear" style="margin-left: 400px;"></div>
		<br/>
		<span class="left" style="margin-left:5px">
		<label>Direcci<h:outputText value="#{msg.tilde_o}" />n comercial <span class="asterisco">*</span></label>
				<h:inputText id="direccionComercial" size="60" maxlength="60" styleClass="validate[required]"
						value="#{proveedorController.proveedor.direccionComercial}" />
		</span>
		<div class="clear" style="margin-left: 400px;"></div>
		<br/>
		<span class="left" style="margin-left:5px">
		<label>Pa<h:outputText value="#{msg.tilde_i}" />s <span class="asterisco">*</span></label>
				<h:inputText id="pais" size="40" maxlength="40" styleClass="validate[required]"
						value="#{proveedorController.proveedor.pais}" />
		</span>
		<span class="left" style="margin-left:5px">
		<label>Ciudad <span class="asterisco">*</span></label>
				<h:inputText id="ciudad" size="40" maxlength="40" styleClass="validate[required]"
						value="#{proveedorController.proveedor.ciudad}" />
		</span>
		<div class="clear" style="margin-left: 400px;"></div>
		<br/>
		<span class="left" style="margin-left:5px">
		<label>Observaci<h:outputText value="#{msg.tilde_o}" />n <span class="asterisco">*</span></label>
				<h:inputTextarea
					id="observacion" cols="40" rows="3" styleClass="validate[maxSize[255]]"
					style="width:350px !important; min-width:350px !important; max-width:350px !important; height:60px !important; min-height:60px !important; max-height:60px !important;"
					value="#{proveedorController.proveedor.observacion}" />
		</span>
		<span class="left" style="margin-left:5px">
		<label>Estado <span class="asterisco">*</span></label>
				<h:selectOneMenu id="estado" styleClass="validate[required]" value="#{proveedorController.proveedor.estado}">
                        <f:selectItem itemLabel="Seleccione..." itemValue=""/>
                        <f:selectItem itemLabel="Activo" itemValue="ACTIVO"/>
                        <f:selectItem itemLabel="Retirado" itemValue="RETIRADO"/>
                </h:selectOneMenu>
		</span>
		</fieldset>
		<div class="clear"></div>
		(<span class="asterisco"> * </span>) : Campo Obligatorio
		<div class="clear"></div>
		<span class="botones right">
		<h:commandButton id="createProveedorButton"						 
		                 type="submit" 
		                 value="Guardar" 
		                 ondblclick="return false;" 
		                 action="#{proveedorController.create}" >
		</h:commandButton>
		</span>
</h:form>
		<span class="botones left">
		<h:form id="cleanProveedorForm">
		<h:commandButton id="cleanProveedordButton"
						 styleClass="botonsmall"
		                 type="submit" 
		                 value="Limpiar" 
		                 ondblclick="return false;" 
                         action="#{proveedorController.createProveedor}" >
		</h:commandButton>		
		</h:form>
		</span>
</div>
<!-- Fin formulario --> 
<div class="clear"></div>
	<div>
		    <h:form id="cancelProveedorForm">
			<h:commandButton id="cancelCreateProveedorButton"
							 styleClass="botonsmall" 
                             type="submit" 
                             value="Cancelar" 
                             ondblclick="return false;" 
                             action="#{proveedorController.cancelProveedor}" >
            </h:commandButton>
            </h:form>
	</div>
</div>
<div class="abajo-cuerpo"></div> <!-- Burrada pa ver borde redondo en IE -->
</div> <!-- Fin contenedor -->
<div class="footer"></div>
	<script src="<%=contextRoot%>/js/jquery/lib/jquery-1.7.2.min.js"></script><!-- De ser 1ro -->
	<script src="<%=contextRoot%>/js/script.js" type="text/javascript"></script><!-- De ser 2do -->
	<script src="<%=contextRoot%>/js/jquery/lib/jquery.uniform.min.js"></script> <!-- formularios -->
	<script src="<%=contextRoot%>/js/jquery/lib/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=contextRoot%>/js/jquery/lib/jquery.validationEngine-es.js" type="text/javascript" charset="utf-8"></script>
    <script src="<%=contextRoot%>/js/jquery.maskedinput-1.3.js" type="text/javascript"></script>
	<script type="text/javascript">
		<!--
        jQ(document).ready(function() {
        	jQ("input, select, input:checkbox, input:radio, input:file").uniform();
        	jQ("#createProveedorForm").validationEngine('attach');
        	jQ("#createProveedorForm").bind("jqv.form.result", 
            	function(event, errorFound) {
        			if(!errorFound){ 
            			displayLoadingImage();
        			}
        		});
        	});
        //-->
    </script>
</body>
</html>
</f:view>
